package com.polytech.diploma.StatAccumulator;

import java.util.Date;

public class ModificationNumAccumulator {

	/**
	 * 
	 * @param precision
	 * by default date interval is calculated in seconds
	 * in other case set precision
	 * 
	 * @param minDate
	 * the date before
	 * 
	 * @param maxDate
	 * the date after
	 * 
	 * @return 
	 * interval between two dates 
	 */
	public static int calculateTimeInterval (DatePrecision precision, Date firstDate, Date secondDate)
	{
		if(precision == null)
			precision = DatePrecision.SECONDS;
		return Math.abs((int)((secondDate.getTime() - firstDate.getTime()) / precision.getPrecision()));
	}
}
